/**
 * 广告相关请求模块
 */
import request from '@/utils/request'

export const getAllSpaces = (pageNum?: number, pageSize?: number) => {
  return request({
    method: 'GET',
    url: '/front/ad/space/getAllSpaces',
    params: {
      pageNum,
      pageSize
    }
  })
}

export const saveOrUpdate = (data: any) => {
  return request({
    method: 'POST',
    url: '/front/ad/space/saveOrUpdate',
    data
  })
}

export const getSpaceById = (id: any) => {
  return request({
    method: 'GET',
    url: '/front/ad/space/getSpaceById',
    params: { id }
  })
}

export const getAdList = (pageNum: number, pageSize: number) => {
  return request({
    method: 'GET',
    url: '/front/ad/getAdList',
    params: {
      pageNum,
      pageSize
    }
  })
}
export const updateStatus = (id: number, status: number) => {
  return request({
    method: 'GET',
    url: '/front/ad/updateStatus',
    params: {
      id,
      status
    }
  })
}

export const adUpdateStatus = (data: any) => {
  return request({
    method: 'POST',
    url: '/front/ad/saveOrUpdate',
    data
  })
}

export const getAdById = (id: any) => {
  return request({
    method: 'GET',
    url: '/front/ad/getAdById',
    params: { id }
  })
}
